
AddCSLuaFile( "shared.lua" )

SWEP.Category 		= "HL2 Beta Sweps"
SWEP.PrintName		= "AR1"	
SWEP.Author		= "Valve"

SWEP.ViewModelFOV	= 55
SWEP.ViewModelFlip	= false
SWEP.ViewModel		= "models/weapons/v_ar1.mdl"
SWEP.WorldModel		= "models/weapons/w_rif_ak47.mdl"
SWEP.AnimPrefix		= "ar2"
SWEP.HoldType		= "ar2"

SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

SWEP.Primary.ClipSize		= 28			// Size of a clip
SWEP.Primary.DefaultClip	= 100			// Default number of bullets in a clip
SWEP.Primary.Automatic		= true			// Automatic/Semi Auto
SWEP.Primary.Delay		= 0.3
SWEP.Primary.Ammo		= "AR2"

SWEP.Secondary.ClipSize		= -1			// Size of a clip
SWEP.Secondary.DefaultClip	= -1			// Default number of bullets in a clip
SWEP.Secondary.Automatic	= false			// Automatic/Semi Auto
SWEP.Secondary.Ammo		= "none"

/*---------------------------------------------------------
	Initialize
---------------------------------------------------------*/
function SWEP:Initialize()
end

/*---------------------------------------------------------
	Holster
---------------------------------------------------------*/
function SWEP:Holster()
end



/*---------------------------------------------------------
	Reload
---------------------------------------------------------*/
function SWEP:Reload()
	if self:DefaultReload( ACT_VM_RELOAD ) then 
		self:EmitSound(Sound("weapons/ar1/ar1_reload.wav")) 
	end
end


/*---------------------------------------------------------
   Think
---------------------------------------------------------*/
function SWEP:Think()
end


/*---------------------------------------------------------
	PrimaryAttack
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
	
                if self.Weapon:CanPrimaryAttack() then
               
                if self.FireMode == 1 then
		self:ShootBullet( 14, 1, 0.4 )
		self.Weapon:SetNextPrimaryFire( CurTime() + 0.11 )
		self:EmitSound( Sound("weapons/oicw/ar2_fire1.wav") )
		self:TakePrimaryAmmo( 1 )
               
                elseif self.FireMode == 2 then
		self:ShootBullet( 16, 1, 0.3 )
		self.Weapon:SetNextPrimaryFire( CurTime() + 0.26 )
		self:EmitSound( Sound("weapons/oicw/ar2_fire1.wav") )
		self:TakePrimaryAmmo( 1 )
                
	        elseif self.FireMode == 3 then
		self:ShootBullet( 20, 1, 0.2 )
		self.Weapon:SetNextPrimaryFire( CurTime() + 0.39 )
		self:EmitSound( Sound("weapons/oicw/ar2_fire1.wav") )
		self:TakePrimaryAmmo( 1 )

                elseif self.FireMode == 4 then
		self:ShootBullet( 27, 1, 0.1 )
		self.Weapon:SetNextPrimaryFire( CurTime() + 0.55 )
		self:EmitSound( Sound("weapons/oicw/ar2_fire1.wav") )
		self:TakePrimaryAmmo( 1 )
          end

end


/*---------------------------------------------------------
	SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()

self.Weapon:EmitSound(Sound("weapons/smg1/switch_single.wav"))

	self.FireMode = self.FireMode + 1;

	if self.FireMode > 4 then

		self.FireMode = 1;

	end

function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW);
return true;
end

if CLIENT then

	function SWEP:DrawHUD()

		if Mode == 1 then

			Text = "l---";

		elseif Mode == 2 then

			Text = "-l--";

		elseif Mode == 3 then

			Text = "--l-";

		elseif Mode == 4 then

			Text = "---l";
                
                end

		draw.SimpleText(Text,"default",ScrW() - 25,ScrH() * 0.8,Color(255,255,255,255),TEXT_ALIGN_RIGHT,TEXT_ALIGN_CENTER);

	end

end